<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
    <title>通知消息模版</title>
    <meta name="decorator" content="default"/>

    <script type="text/javascript">
        $(document).ready(function () {
            $("#value").focus();
            $("#inputForm").validate({
                submitHandler: function (form) {
                    loading('正在提交，请稍等...');
                    form.submit();
                },
                errorContainer: "#messageBox",
                errorPlacement: function (error, element) {
                    $("#messageBox").text("输入有误，请先更正。");
                    if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
                        error.appendTo(element.parent().parent());
                    } else {
                        error.insertAfter(element);
                    }
                }
            });
        });
        $(function(){
            if ($("#type").val()=="0"){
                $("#wechatTemplate_div").hide();
                $("#templateExample_div").hide();
            }else{
                $("#wechatTemplate_div").show();
                $("#templateExample_div").show();
            }
            $("#type").change(function() {
                if ($(this).val()=="0"){
                    $("#wechatTemplate_div").hide();
                    $("#templateExample_div").hide();
                }else{
                    $("#wechatTemplate_div").show();
                    $("#templateExample_div").show();
                }
            });
        })
    </script>
</head>
<body>
<ul class="nav nav-tabs">
    <li><a href="${ctx}/business/messagetemplate">通知消息模版列表</a></li>
    <li class="active"><a href="${ctx}/business/messagetemplate/look?id=${messageTemplate.id}">通知消息模版查看</a></li>
</ul>
<br/>
<form:form id="inputForm" modelAttribute="messageTemplate" action="${ctx}/business/messagetemplate/save" method="post"
           class="form-horizontal">
    <form:hidden path="id"/>
    <tags:message content="${message}"/>
    <div class="control-group">
        <label class="control-label">模板名称:</label>
        <div class="controls">
            <form:input path="name" name="name" htmlEscape="false" maxlength="50" class="required" readonly="true"/>
            <span class="help-inline"><font color="red">*</font> </span>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">类型:</label>
        <div class="controls">
            <form:select path="type" name="type" class="input-medium required" disabled="true">
                <form:options items="${dic:getBusDictList('tb_message_template_type')}" itemLabel="label"
                              itemValue="value" htmlEscape="false"/>
            </form:select>
            <span class="help-inline"><font color="red">*</font> </span>
        </div>
    </div>
    <div class="control-group" id ="wechatTemplate_div" style="display: none">
        <label class="control-label">微信模板ID:</label>
        <div class="controls">
            <form:input path="weChatTemplateId" name="weChatTemplateId" htmlEscape="false" maxlength="50"
                        class="required" readonly="true"/>
            <span class="help-inline"><font color="red">*</font> </span>
        </div>
    </div>
    <div class="control-group" id="templateExample_div">
        <label class="control-label">模板实例:</label>
        <div class="controls">
            <form:textarea path="templateExample" htmlEscape="false" rows="5" maxlength="200" class="input-xlarge" readonly="true"/>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">模板内容:</label>
        <div class="controls">
            <form:textarea path="templateContent" htmlEscape="false" rows="5" maxlength="200" class="input-xlarge" readonly="true"/>
        </div>
    </div>

    <div class="control-group">
        <label class="control-label">自定义属性名:</label>
        <div class="controls">
            <form:input path="attributeName" name="attributeName" htmlEscape="false" maxlength="50" class="required" readonly="true"/>
            <span class="help-inline"><font color="red">*</font> </span>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">自定义属性值:</label>
        <div class="controls">
            <form:input path="attributeValue" name="attributeValue" htmlEscape="false" maxlength="50" class="required" readonly="true"/>
            <span class="help-inline"><font color="red">*</font> </span>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">状态:</label>
        <div class="controls">
            <form:select path="status" name="type" class="input-medium required" disabled="true">
                <form:options items="${dic:getBusDictList('tb_message_template_status')}" itemLabel="label"
                              itemValue="value" htmlEscape="false"/>
            </form:select>
            <span class="help-inline"><font color="red">*</font> </span>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">是否可修改:</label>
        <div class="controls">
            <form:select path="editable" name="type" class="input-medium required" disabled="true">
                <form:options items="${dic:getBusDictList('tb_message_template_editable')}" itemLabel="label"
                              itemValue="value" htmlEscape="false"/>
            </form:select>
            <span class="help-inline"><font color="red">*</font> </span>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">接收人:</label>
        <div class="controls">
            <form:select path="receive" name="type" class="input-medium required" disabled="true">
                <form:options items="${dic:getBusDictList('tb_message_template_receive')}" itemLabel="label"
                              itemValue="value" htmlEscape="false"/>
            </form:select>
            <span class="help-inline"><font color="red">*</font> </span>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">备注:</label>
        <div class="controls">
            <form:textarea path="remarks" htmlEscape="false" rows="3" maxlength="200" class="input-xlarge" readonly="true"/>
        </div>
    </div>
    <div class="form-actions">
        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
    </div>
</form:form>

</div>
</body>
</html>